<?php


namespace core\lib;


use Monolog\Handler\StreamHandler;

/**
 * Class Logger
 * @package core\lib
 */
class Logger {

    /**
     * @var \Monolog\Logger
     */
    protected static $logger;

    public static function getInstance(): \Monolog\Logger {
        if (is_null(self::$logger)) {
            self::$logger = new \Monolog\Logger('kyouka');
            self::$logger->pushHandler(new StreamHandler(__ROOT__ . "/runtime/" . date('Y-m-d') . ".log", \Monolog\Logger::DEBUG));
        }
        return self::$logger;
    }

}
